﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:local="clr-namespace:ProfilerPDS"
	mc:Ignorable="d"
	x:Class="ProfilerPDS.MainWindow"
	x:Name="Window"
	Title="Profiler"
	Width="1024" Height="800"
	WindowStartupLocation="CenterScreen "
	ResizeMode="CanResizeWithGrip" Icon="/ProfilerPDS;component/images/Application.png" WindowState="Maximized">
	<Window.Resources>
		<Style x:Key="datagridColumnHeaderStyle" TargetType="DataGridColumnHeader">
			<Setter Property="Background" >
				<Setter.Value>
					<LinearGradientBrush StartPoint="0.5,0"  EndPoint="0.5,1" >
						<LinearGradientBrush.GradientStops>
							<GradientStop Color="Beige" Offset="0" />
							<GradientStop Color="Aqua" Offset="1" />
							<GradientStop Color="red" Offset="0.172"/>
						</LinearGradientBrush.GradientStops>
					</LinearGradientBrush>
				</Setter.Value>
			</Setter>
			<Setter Property="Foreground" Value="#FFF5FB88" />
		</Style>


	</Window.Resources>
	<Window.CommandBindings>
		<CommandBinding Command="Open" Executed="openHandle" CanExecute="canOpen"/>
		<CommandBinding Command="Save" CanExecute="canSave" Executed="saveHandle"/>
		<CommandBinding Command="Close" CanExecute="canClose" Executed="closeHandle"/>
		<CommandBinding Command="{x:Static local:MainWindow.StartDrawCommand}" CanExecute="canStartDraw" Executed="StartDrawHandle"/>

	</Window.CommandBindings>
	<Grid x:Name="LayoutRoot">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="auto"/>
			<RowDefinition Height="auto"/>
			<RowDefinition Height="1*"/>
			<RowDefinition Height="auto"/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>
		<Menu    IsMainMenu="True" Margin="0,0,0,0" Grid.Row="1">
			<MenuItem Header="File">
				<MenuItem Header="Open Log" Command="Open" ToolTip="Open Log File"></MenuItem>
				<MenuItem Header="Save Log" Command="Save" ToolTip="Save Log File"></MenuItem>
				<Separator/>
				<MenuItem Header="Export To">
					<MenuItem Header="Sequence Diagram" Click="exportSeqDiaBtn_Click" ></MenuItem>
					<MenuItem Header="All Events"></MenuItem>
				</MenuItem>
				<MenuItem Header="Close" ToolTip="Close The Application" Command="Close" ></MenuItem>
			</MenuItem>
			<MenuItem Header="Edit">
                <MenuItem Header="Tracing options">
                    <MenuItem Header="Disable variables profiling" IsCheckable="True" IsChecked="True" Click="TracingOptions_DisableVarProf_Click"></MenuItem>
                </MenuItem>
            </MenuItem>
			<MenuItem Header="About">
				<MenuItem Header="Info"/>
				<Separator/>
				<MenuItem Header="Help"/>
			</MenuItem>
		</Menu>
		<ToolBar HorizontalAlignment="Left" d:LayoutOverrides="Height" Grid.Row="2" Foreground="#FF0068E1">
			<Button Name="searchApplication" Click="searchApplication_Click" ToolTip="Search the Application To Profile">
				<Image Source="images\searchApplication.png" Width="24" Height="24" Margin="0,0,0,0" VerticalAlignment="Center"></Image>
			</Button>
			<TextBlock Name="applicationPathTxt" MinWidth="100" Text="Choose An Application " VerticalAlignment="Center" />
			<Button  Command="{x:Static local:MainWindow.StartDrawCommand}">
				<Image Source="images\startDraw.png" Width="25" Height="25" Margin="0,0,0,0" VerticalAlignment="Center"></Image>
			</Button>
			<Label VerticalContentAlignment="Center">Scale X</Label>
			<Slider x:Name="zoomSliderX" ToolTip="Scale X" Width="100" Height="auto" Minimum="0.1" Maximum="5" Value="1" VerticalAlignment="Center" HorizontalAlignment="Left" />
			<Label VerticalContentAlignment="Center">Scale Y</Label>
			<Slider x:Name="zoomSliderY" ToolTip="Scale Y" Width="100" Height="auto" Minimum="0.1" Maximum="5" Value="1" VerticalAlignment="Center" HorizontalAlignment="Left" />
			<CheckBox Name="lockZoomChb" Width="16" Height="16" ToolTip="Lock" BorderBrush="Black" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
			<Label VerticalAlignment="Center">Lock</Label>
		</ToolBar>
		<Grid  Grid.Row="3"  >		
			<TabControl  Grid.Column="0" Margin="0,0,0,15.96"   Background="Azure">
				<TabItem Header=" Graphics ">
					<Grid Background="#FFE5E5E5">
						<ScrollViewer Width="auto" Height="auto" HorizontalScrollBarVisibility="auto" VerticalScrollBarVisibility="auto" CanContentScroll="True">
							<Grid >
								<Canvas Name="drawAreaCanvas" Background="White" Height="1" Width="1" ClipToBounds="True" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
									<Canvas.LayoutTransform>
										<ScaleTransform ScaleX="{Binding ElementName=zoomSliderX, Path=Value}" ScaleY="{Binding ElementName=zoomSliderY, Path=Value}"/>
									</Canvas.LayoutTransform>
									<!-- <local:Arrow X1="135" Y1="135" X2="225" Y2="150" HeadWidth="10" HeadHeight="7" Stroke="Green" StrokeThickness="1.0" />-->
								</Canvas>
							</Grid>
						</ScrollViewer>
					</Grid>
				</TabItem>
				<TabItem Header="All Events" Name="allEventsTab"  GotFocus="allEventsTab_GotFocus">
					<Grid Background="#FFE5E5E5">
						<DataGrid  Name="eventsDg" IsSynchronizedWithCurrentItem="True" AutoGenerateColumns="False" CanUserReorderColumns="False" CanUserResizeRows="False" AlternatingRowBackground="AliceBlue">
							<DataGrid.Columns>
								<DataGridTextColumn Header="Event" Width="SizeToCells"   
										   Binding="{Binding EventName}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Class ID" Width="SizeToCells"   
										   Binding="{Binding Path=IdClass}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Object ID" Width="SizeToCells"   
										   Binding="{Binding Path=IdObject}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Function Name" Width="SizeToCells"   
										   Binding="{Binding Path=NameFunction}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Function ID" Width="SizeToCells"   
										   Binding="{Binding Path=IdFunction}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Thread Name" Width="SizeToCells"   
										   Binding="{Binding Path=NameThread}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Thread ID" Width="SizeToCells"   
										   Binding="{Binding Path=idThread}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Stack Depth" Width="SizeToCells"   
										   Binding="{Binding Path=StackDepth}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Exception Name" Width="SizeToCells"   
										   Binding="{Binding Path=ExceptionName}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Static" Width="SizeToCells"   
										   Binding="{Binding Path=IsStatic}" 
										   IsReadOnly="True" MinWidth="100" />
								<DataGridTextColumn Header="Time" Width="SizeToCells"   
										   Binding="{Binding TimeStamp}" 
										   IsReadOnly="True" MinWidth="100" />
							</DataGrid.Columns>
						</DataGrid>
					</Grid>
				</TabItem>
			</TabControl>


		</Grid>
		<StatusBar Grid.Row="4" Background="Beige">
			<Label FontWeight="Bold">Application:</Label>
			<Label Name="selectedApplicationLbl">Not Set</Label>
			<Label FontWeight="Bold">Events:</Label>
			<Label Name="numbersOfEventsLbl">0</Label>
		</StatusBar>
	</Grid>
</Window>